package com.neu.controller;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.neu.po.ResponseResult;
import com.neu.po.User;
import com.neu.service.UserService;

@RestController
@RequestMapping("user")
public class UserComtroller {
	@Autowired
	private UserService userService;
	
	@RequestMapping("login")
	public ResponseResult login(String username,String password) {
		ResponseResult result = new ResponseResult();
					
		User user = userService.login(username, password);
		
		if(user == null) {
			result.setResult("error");
			result.setData("用户名或密码输入错误，登录失败！");
		}else {
			result.setData(user);
		}		
		
		return result;
	}
}
